// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ViewInitializationMessage.cs" company="Microsoft Corporation">
// The MIT License (MIT)
// 
// Copyright (c) 2014, Microsoft Corporation
// 
// Permission is hereby granted, free of charge, to any person obtaining a copy
//  of this software and associated documentation files (the "Software"), to deal
//  in the Software without restriction, including without limitation the rights
//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//  copies of the Software, and to permit persons to whom the Software is
//  furnished to do so, subject to the following conditions:
// 
// The above copyright notice and this permission notice shall be included in
//  all copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
//  THE SOFTWARE.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace Microsoft.Robotics.Visualization
{
    using System.Windows;
    using Microsoft.Robotics.Runtime;

    /// <summary>
    /// Control message sent by the UI to a model. The message includes a a reference to the view that uses the model. 
    /// The model is expected to call the view in response to the control message, providing a reference to a data-bindable model.
    /// </summary>
    /// <remarks>No need to mark this as a data contract, since this message cannot be serialized (the view and the agent must reside in the same process)</remarks>
    public class ViewInitializationMessage : AgentMessage
    {
        /// <summary>
        /// The view what wants to data-bind to the model generated by the model agent.
        /// </summary>
        private FrameworkElement view;

        /// <summary>
        /// The main display window.
        /// </summary>
        private MainWindow mainWindow;

        /// <summary>
        /// Initializes a new instance of the ViewInitializationMessage class.
        /// </summary>
        /// <param name="view">The view what wants to data-bind to the model generated by the model agent.</param>
        /// <param name="mainWindow">Main display window</param>
        public ViewInitializationMessage(FrameworkElement view, MainWindow mainWindow)
            : base(AgentMessage.GetCurrentTime())
        {
            this.view = view;
            this.mainWindow = mainWindow;
        }

        /// <summary>
        /// Gets the view what wants to data-bind to the model generated by the model agent.
        /// </summary>
        public FrameworkElement View
        {
            get
            {
                return this.view;
            }
        }

        /// <summary>
        /// Gets the main display windows.
        /// </summary>
        public MainWindow MainWindow
        {
            get
            {
                return this.mainWindow;
            }
        }
    }
}
